package com.usian.comment.controller.v1;


import com.usian.comment.service.CommentReplyService;
import com.usian.common.dtos.ResponseResult;
import com.usian.model.comment.dtos.CommentReplyDto;
import com.usian.model.comment.dtos.CommentReplyLikeDto;
import com.usian.model.comment.dtos.CommentReplySaveDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
 * 评论回复
 */
@RestController
@RequestMapping("/api/v1/comment_reply")
public class CommentReplyController {

    @Autowired
    private CommentReplyService commentReplyService;

    /**
     * 保存评论回复
     */
    @PostMapping("/save")
    public ResponseResult saveReply(@RequestBody CommentReplySaveDto dto){
        commentReplyService.saveCommentReply(dto);
        return ResponseResult.ok();
    }

    /**
     * 查询回复列表
     */
    @PostMapping("/load")
    public ResponseResult loadReply(@RequestBody CommentReplyDto dto){
        commentReplyService.loadCommentReply(dto);
        return ResponseResult.ok();
    }

    /**
     * 回复点赞
     */
    @PostMapping("/like")
    public ResponseResult likeReply(@RequestBody CommentReplyLikeDto dto){
        commentReplyService.saveCommentReplyLike(dto);
        return ResponseResult.ok();
    }
}
